package com.icinfo.cloud.provider.punish.controller;

import com.alibaba.fastjson.JSONObject;
import com.icinfo.cloud.provider.punish.dto.AppCaseConvertTemporaryRecordDto;
import com.icinfo.cloud.provider.punish.dto.AppCaseGetConvertTemporaryInfoDto;
import com.icinfo.cloud.provider.punish.service.IAppCaseConvertTemporaryRecordService;
import com.icinfo.framework.common.web.Result;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 案件临时数据转换
 *
 * @author: Kexin.Hu
 * @date: 2024/3/15 16:29
 */
@RestController
@RequestMapping("/app/case/convert")
public class AppCaseConvertTemporaryRecordController {

    @Resource
    private IAppCaseConvertTemporaryRecordService appCaseConvertTemporaryService;


    /**
     * 临时数据转换及保存
     */
    @PostMapping("/save")
    public Result<String> save(@Validated @RequestBody AppCaseConvertTemporaryRecordDto dto) {
        appCaseConvertTemporaryService.save(dto);
        return Result.success("操作成功");
    }

    /**
     * 获取当前用户的案件转换临时数据
     */
    @GetMapping("/getCurrentUserConvertTemporaryInfo")
    public Result<JSONObject> getCurrentUserConvertTemporaryInfo(@Validated @RequestBody AppCaseGetConvertTemporaryInfoDto dto) {
        return Result.success("获取成功", appCaseConvertTemporaryService.getCurrentUserConvertTemporaryInfo(dto));
    }


}
